﻿using System;
using System.Linq;
using Wicresoft.RDW.Presentation;
using Wicresoft.RDW.Utility;

namespace Wicresoft.RDW.Request
{
    public partial class TestApply : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Apply((int)RequestStatus.Draft);
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Apply((int)RequestStatus.Pending);
        }
        protected void Apply(int status)
        {
            if (Id == 0)
            {
                Model.Request request = RequestBasic.RequestData;
                request.Status = status;
                request.TestRequest.Add(TestRequest.TestRequestData);
                RequestPresent.Create(request);

                //Model.TestPerson testPerson = TestRequest.TestPersonData;
                //testPerson.TestRequestId = TestRequestPresent.GetList().LastOrDefault().TestRequestId;
                //TestPersonPresent.Create(testPerson);
            }
        }
    }
}